import { Component } from "react";

export default class ClassCom2 extends Component {
  state = { num: 0 };
  // handleClick = () => {
  //   this.setState({ num: this.state.num + 1 });
  // };
  handleClick = function () {
    this.setState({ num: this.state.num + 1 });
  };
  render() {
    const { num } = this.state;
    return (
      <div>
        <h5>{num}</h5>
        {/* <button onClick={this.handleClick}>+++</button> */}
        <button onClick={this.handleClick.bind(this)}>+++</button>
      </div>
    );
  }
}
